<template>
	<view class="w100 h100">
		<view class="w100 h100">
			<view class="card c3 mb10 cshow" v-for="(form,index) in orderList" :key="index" @click="toDtail(form)">
				<view class="bd1 dfa pb10">
					<view class="f-c-s f-1">
						<view class="c0">
							<view class="dfa">
								<text class="wei"></text>
								<text class="f24 wei6" v-if="form.user && form.user.mobile">尾号{{form.user.mobile.substr(form.user.mobile.length-4)}}</text>
							</view>
							<view class="mt5">
								<text class="pl5 c6 f10">{{form.diningTypeFormat}}<text class="mlr5">/
								</text>{{form.created_at}}</text>
							</view>
						</view>
					</view>
					<view class="f-c-e wei6">
						<view>
							<text class="pr5 c0">{{form.stateForamt}}</text>
						</view>
						<text class="f10 p5 c9 bf8 mt5 bs4">{{form.payTypeFormat}}</text>
					</view>
				</view>
				<view class="mt10 f-bt bd1 pb10" v-if="form.user">
					<view class="dfa f-g-1">
						<view class="f-e-c">
							<text class="c3">{{form.user.nickname}}</text>
							<text class="f10 c9 mt5">{{form.user.mobile}}</text>
							<view class="dfbc" v-if="form.payNum">
								<text class="f10 p5 c9 bf8 mt5 bs4" v-if="form.payNum==1">门店新客</text>
								<text class="f10 p5 c9 bf8 mt5 bs4" v-else>第{{form.payNum}}次下单</text>
							</view>
						</view>
					</view>
					<view class="f-g-0 mr10" @click.stop="tocenter(form.user.mobile)">
						<u-icon name="phone-fill" color="#000" size="30"></u-icon>
					</view>
				</view>
				<view class="bf f-row p-5-0" v-if="form.goods">
					<view class="f-g-0 mr30">
						<view class="imgw bs10 bf7">
							<image :src="form.goods.icon" mode="scaleToFill" class="wh" />
						</view>
					</view>
					<view class="f-g-1 f-y-bt ml10">
						<view class="wei4 f14 t-o-e2 c3">{{form.goods.name}}</view>
						<view class="f-x-bt">
							<view class="cfa t-o-e wei4">
								<text v-if="form.goods.integral>0">{{form.goods.integral}}</text>
								<text v-if="form.goods.integral>0" class="f13 nowei">积分</text>
								<text v-if="form.goods.integral>0 && form.goods.money>0" class="nowei">+</text>
								<text v-if="form.goods.money>0"><text class="f12">￥</text>{{form.goods.money}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="dfbc">
					<view class="f12">
						<!-- <view class="mb5">操作人：<text v-if="form.admin">{{form.admin.nickname}}</text></view> -->
						<view class="mb5 mt5">订单来源：微信小程序</view>
						<view class="mb5">订单编号：{{form.orderSn}}</view>
					</view>
				</view>
				<view class="f-x-e mt10 pt10 bt1">
					<!-- <view class="f-g-0 w33 p-0-10" @click.stop="$emit('op','refund',form)" v-if="form.state==7">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" :plain="true"
							text="同意退款" color="#e4e4e4" shape="circle">
						</u-button>
					</view>
					<view class="f-g-0 w33 p-0-10"  v-if="form.state==7"
						@click.stop="$emit('op','rejectRefund',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" text="拒绝退款"
							:color="subColor" shape="circle">
						</u-button>
					</view> -->
					<view v-if="form.state == 2" class="f-g-0 w33 p-0-10"
						@click.stop="$emit('op','comDelivery',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}" text="核销"
							:color="subColor" shape="circle">
						</u-button>
					</view>
					<!-- <view class="f-g-0 w33 p-0-10" @click.stop="$emit('op','orderPrint',form)">
						<u-button type="primary" :customStyle="{marginLeft: '20rpx',color:'#000'}"  :plain="true"
							text="打印" color="#e4e4e4" shape="circle">
						</u-button>
					</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			orderList: {
				type: Array,
				default () {
					return []
				}
			},
			current: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				subColor: uni.getStorageSync('subject_color'),
			}
		},
		methods: {
			tocenter(e) {
				uni.makePhoneCall({
					phoneNumber: e
				});
			},
			toDtail(v) {
				return
				uni.navigateTo({
					url: `/pages/order/detail?id=${v.id}`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.imgw {
		width: 100rpx;
		height: 100rpx;
	}
</style>